<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<c:set var="reportTitle" value="PECVD膜厚等级比例报表" scope="session"/>

<%@ include file="/common/report_head.jsp" %>
<%@ include file="/condition/sartTime_input.html"%>
<%@ include file="/condition/endTime_input.html"%>
<%@ include file="/condition/line_sumo.html"%>
<%@ include file="/condition/tool_sumo.html"%>
<%@ include file="/condition/pipeNumber_sumo.html"%>
<%@ include file="/condition/zhNumber_sumo.html"%>
<%@ include file="/condition/zhCount_sumo.html"%>
<%@ include file="/condition/zhPlace_sumo.html"%>

<%@ include file="/common/report_middle.jsp" %>
<%@ include file="/charts-grid/echarts2.html"%>
<div class="col-md-12" style="height: 420px;">
    <div id="pqGrid"></div>
</div>
<%@include file="/common/report_end.jsp" %>


<script>
    $(document).ready(function () {
        $("title").text("PECVD膜厚等级比例报表");

        $('#query_btn').click(function (){
            initGridAndChart();
            ajax('/jn-report/report/pecvd_2_report.do' ,loadConditionMapData(), true, ajax_successful);

            function ajax_successful(outTrxObj) {
                if(outTrxObj.gridData.length < 1) { showMessengerDialog("数据查询为空"); return false; }

                //Chart图数据赋值
                var echartsData = outTrxObj.chartsData;
                option.color = ['#4F81BD', '#C0504D', '#DA953A', '#64D5F4', '#A5A5A5', '#FEC00F',  '#70AD47', '#255E91', '#636363', '#997311', '#264378','red', 'green', 'cyan', 'blue', 'purple',
                    'violet', 'skyblue', 'tan', 'wheat', 'darkkhaki', '#f7acbc', '#deab8a', '#817936', '#444693', '#f05b72', '#8f4b2e', '#f47920', '#ef5b9c', '#fedcbd', '#b2d235', '#1a2933', '#2a5caa'], //调色盘
                    option.grid.left = '5%';
                option.backgroundColor = 'white';
                option.grid.show = false;
                option.title.text = echartsData.title;
                option.legend.data = [];
                option.legend.data = echartsData.legendData;
                option.xAxis[0].data = [];
                option.xAxis[0].data = echartsData.xAxisData;
                option.yAxis[0].axisLabel = {formatter: '{value} %'};
                option.yAxis[0].min = 0;
                option.series = [];
                //柱状图
                for (var i=0; i< echartsData.legendData.length; i++) {
                    option.series.push({
                        name: echartsData.legendData[i],
                        type: 'bar',
                        stack: "总量",
                        barMaxWidth: 30,
                        data: echartsData.seriesDatas[i]
                    });
                }
                myChart.clear();
                myChart.setOption(option);

                //grid表格数据
                var colM =[{halign:"center",align:'center', dataIndx: 'pipeNumber', title: '管号', width: 130, editable: false, sortable: true}];
                for (var i=0; i<outTrxObj.dynamicColumn.length; i++){
                    var grade = outTrxObj.dynamicColumn[i];
                    colM.push({halign:'center', align:'center', dataIndx: grade, title: grade, width: 130, editable: false, sortable: true});
                }
                _pqUtil.f.setColModel($("#pqGrid"), colM);
                _pqUtil.f.seTitle($("#pqGrid"), "PECVD膜厚等级比例表格");
                _pqUtil.f.isShowTitle($("#pqGrid"), false);
                _pqUtil.f.loadPqGridData($("#pqGrid"), outTrxObj.dynamicColumnJsonGridData);
            }
        });

    });
</script>
